/**
 * 
 */
package com.xy.commons;

/**
 * @author admin
 * 
 */
public class PageUtil {
	public static final String ITEMS = "ITEMS";
	public static final String TOTALS = "TOTALS";
    public static final String CURRENT = "CURRENT";
    public static final String PAGESIZE = "PAGESIZE";
    public static final String TOTALPAGE = "TOTALPAGE";

	public static int getStart(int page, int pageSize) {
		return (page - 1) * pageSize;
	}

	public static int getEnd(int page, int pageSize) {
		return page * pageSize;
	}

    public static int getTotalPage(int totals, int pageSize) {
        if(totals % pageSize == 0){
            return totals / pageSize;
        }else{
            return totals / pageSize + 1;
        }
    }
}
